Results 1 to 6 of 6

Thread: response write a javascript

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Posts
    157

    response write a javascript

    currently i have this line in html using javascript

    <div align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image32','','search1.gif',1)"><img name="Image32" border="0" src="search.gif" width="98" height="31"></a></div>

    i want to do an if statment
    if strname <> "" then
    response.write the above html/javascript
    else
    response.write "you are not logged in"
    end if

    if i do response.write "<div align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image32','','search1.gif',1)"><img name="Image32" border="0" src="search.gif" width="98" height="31"></a></div>"
    i get errors saying end of statment expected and stuff
    any suggestions
    cheers

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113

    brackets

    round ones that is.
    i.e.
    response.write ("<div align="center">...yadda yadda yadda </div>")

    also dont u need the semi colons after the javascript statements?
    ;
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

  3. #3
    kayoca
    Guest
    Proberly because your using " within ". Try using single ' within double ".
    Code:
    response.write "<div align='center'><a href='#' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage('Image32','','search1.gif',1)'><img name='Image32' border='0' src='search.gif' width='98' height='31'></a></div>"

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2000
    Posts
    157
    nope i have tried both ways and neither of them work
    any more suggestions guys

  5. #5
    Lively Member
    Join Date
    Jan 2001
    Posts
    72

    try both

    Try using both "round" brackets (nice way of putting it) and single quotes.

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    your problem lies here:

    onMouseOver='MM_swapImage('Image32','','search1.gif',1)'
    you need it to be:
    onMouseOver="MM_swapImage('Image32','','search1.gif',1)"

    Try this...

    response.write "<div align='center'><a href='#' onMouseOut='MM_swapImgRestore()' onMouseOver=" & chr(34) & "MM_swapImage('Image32','','search1.gif',1)" & chr(34) & "><img name='Image32' border='0' src='search.gif' width='98' height='31'></a></div>"
    Mark
    -------------------

Posting Permissions

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



Click Here to Expand Forum to Full Width