Results 1 to 11 of 11
Related
-
Please Help in a JavaScript Problem Forum: Javascript Forum
Replies: 2 -
javascript link problem Forum: Javascript Forum
Replies: 4 -
Simple Javascript Problem - I think... Forum: Javascript Forum
Replies: 3 -
Javascript active link problem Forum: Javascript Forum
Replies: 0 -
problem with javascript opening a new window Forum: Javascript Forum
Replies: 4
-
10-22-2002, 04:48 PM #1
Help me with a Javascript problem!
I am trying to define a fucntion with three parameters, URL, height and width so that I can open windows, with different HTML pages, with different sizes. I did the following:
==================
<SCRIPT LANGUAGE="javascript">
function openwin(htmlpage,mwidth,mheight)
{
window.open(htmlpage,'mywin', mwidth, mheight,'toolbar=no,menubar=no')
}
</SCRIPT>
Above defines the function with three variables.
Then at some appropriate point, I assign the variables as follows:
<SCRIPT LANGUAGE="javascript">
{var htmlpage="mypage.htm";
var mwidth=1024;
var mheight=700;
}
</SCRIPT>
Then I call the function:
<A HREF="javascriptpenwin(htmlpage,mwidth,mheight)">
Click here to open the window
</a>
But the opened window size is not of the values in the variables! Help please! I am losing my mind and sleep!
Thanks!
-
10-22-2002, 05:09 PM #2
Hi there.
Two things to remember, the a href tag is just HTML, its not clever enough to figure out that you are usign variables. So first off, call your function like this -
Code:<A HREF="javascript: openwin('mypage.htm','1024','700')"> Click here to open the window </a>
Code:window.open(htmlpage,'mywin', 'width=' + mwidth +', height=' + mheight + ',toolbar=no,menubar=no')
by the way, welcome to the forums!If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
10-22-2002, 05:59 PM #3
As you had pointed out, my format for window opening was indeed wrong - all I had to do was copy your tip into the page, and bingo! Everything works! Many many thanks! Glad I gave the bread to the baker!
-
10-29-2002, 10:12 PM #4
I have one more question to the Guru - if in the above function, I call an image as the file name (like xyz.jpg), the resulting window contains the image with an offset in both x and y directions, in the top left corber of the window. If on the other hand, I put the image in a html page and call that html page, the image appears flush with the top left corner of the window. But I hate to create multiple html pages containing tens of images. How can I call the image window and not have an offset at the top left corner? Many thanks in advance.
-
10-30-2002, 03:54 PM #5
Hmm. I do not get an offset, but then again, I use Mozilla, so maybe thats it.
The problem with calling direct to an image is that the control is then completely out of your control, and into the browsers.
Instead of hardcoding lots and lots of pages, how about using a server side script to achieve it?
For example, PHP would handle it like this -
Save a file called image.php with this code in -
PHP Code:<img src="<? echo $_GET['image']; ?>.jpg">
Code:href="javascript:openwin('image.php?image=Picture', '800', 600')"
The only thing to watch would be not using the entire filename in the variable, as a user can change the url and end up accessing the servers file system if you are not careful.
This relies on your server having php, so have a look and see if it works (dontr forget to call the file .php !)If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
11-01-2002, 10:24 AM #6
QuietDean:
Can't find the thread from yesterday where you gave the URL to the Mozilla download so will ask here.
I downloaded and installed it but it's not recognizing any of my JavaScript code. Couldn't find an option to fix that. Can you provide the 'super secret' instructions to enable JavaScript in Mozilla 1.1?
-
11-01-2002, 01:42 PM #7
Sure, its -
Edit/Preferences/Advanced/Scripts & WIndows
Set it to enalbe JavaScript for Navigator, then choose from the box below what you would like to work and whatnot.
Be aware, a lot of JavaScript is , again, only for IE . Once again Microsoft promised to support a standard, then changed the standard so as to force it out of the hands of the average user.
If in doubt, try a very simple test script and see if it works.If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
11-01-2002, 07:25 PM #8
Have 'all' the boxes checked at
Edit/Preferences/Advanced/Scripts&Plugins
but neither inline nor .js file referenced SCRIPTs are being read. Guess my web sites are going to make sense only to IE users until I figure out an alternative to the .js referenced files.
-
11-02-2002, 05:40 AM #9
Yours is different to mine, I got the latest 'stable' release, Mozilla 1.0 .
Maybe you got the beta release? It may be a bug that JavaScript is not working, as JavaScript includes work fine for me. The only thing that never seems to affect my browser is things like 'no right click' and stuff like that.
Check out your version, compare, maybe download the stable release if your is different to mine.If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
-
11-02-2002, 10:26 AM #10
Thanks, will go back and get the 1.0 version and see. What I did download was supposed to be the stable version prior to the 1.2 beta now being tested.
Just installed version 1.0.1 and have same problem. Couldn't see where I could get just version 1.0. Also tried to access this forum to edit this messageand couldn't without logging in "under an unsecure" process according to the pop-up - mostly likely due to the new browser being used. Are there other Mozilla initialization steps I'm missing?
(This version has a readme.txt file - it not having anything in it but installation instructions. The prior download referenced that file but didn't include it.)Last edited by benzden; 11-02-2002 at 10:52 AM.
-
11-02-2002, 01:23 PM #11
hmm. I just installed and ran
If one of our members helps you, please click theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum