Passing a URL with JavaScript

Results 1 to 3 of 3

Thread: Passing a URL with JavaScript

  1. #1
    Donna J. Guest

    Default Passing a URL with JavaScript

    I would be grateful for some assistance on the following problem.<BR><BR>I have a link that when clicked uses the following code to open a new window and load a small form into it.<BR><BR>function win1() <BR>{"sales/One.asp","","height=200,width=200,left=320,top=180 ");}<BR><BR>I would like to be able to have a list of about 80 hyperlinks that when clicked use the same function (win1) but pass their own url to that function. I currently have 80 functions labelled win1- win80 and it&#039s not pleasant &#060;g&#062;. I assume it is possible to pass the relevant URL to the function?<BR><BR>The hyperlink code is..<BR>&#060;a href="javascript:win1()"&#062;Sales- One&#060;/a&#062;<BR><BR>Thanks

  2. #2
    KPW Guest

    Default RE: Passing a URL with JavaScript

    I believe this is what you&#039re looking for:<BR><BR>&lt;HTML&gt;<BR>&lt;HEAD&gt;<BR>&lt;TI TLE&gt;Sample&lt;/TITLE&gt;<BR>&lt;script language="javascript"&gt;<BR>function myRedirect(sURL) {<BR> top.location.href=sURL;<BR>}<BR>&lt;/script&gt;<BR>&lt;/head&gt;<BR>&lt;body&gt;<BR>&lt;a href="javascript:myRedirect(&#039"&#062;Star Wars home page&lt;/a&gt;<BR>...<BR>&lt;/body&gt;<BR>&lt;/html&gt;

  3. #3
    Join Date
    Dec 1969

    Default RE: Passing a URL with JavaScript

    In the script section:<BR><BR>function win1(myURL) <BR>{,"","height=200,width=200,le ft=320,top=180");}<BR><BR>In the hyperlink code:<BR><BR>&#060;a href="javascript:win1(theURL)"&#062;Sales - One &#060;/a&#062;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts