Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Hex-sign as function parameter

Status
Not open for further replies.
you should always pass strings to functions using standard string encapsulators, either the single-quote (') or double-quote ("). your function call should be:

Code:
newwindow(1, [red][b]"[/b][/red][URL unfurl="true"]http://cognet.org.me/kb#academic[/URL][red][b]"[/b][/red])



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Hi Nick & cLFlaVA.

The thing is, that value actually is from a variable. Maybe I should put all the things in more complete. Please have a look... I also have done what cLFlaVA asked.

The function...
function newwindow(myTp,myURI)
{
if (myTp==1) {
window.open('UIClass.php?shwTp=' + myTp + '&clsURI=' + myURI,'Class Details','width=300,height=200,resizable=yes');
} else {
window.open('UIClass.php?shwTp=' + myTp + '&clsURI=' + myURI,'Class Instances','width=300,height=200,resizable=yes');
}
}

The caller...
javascript:newwindow(1,"
The window shown...
Class Name: SuperClass: none
SubClass: none
Properties: none

As you see, I missed the "#academic" part.
cheers,
Gabriel
 
so you want it to actuall open this window?

[tt]UIClass.php?shwTp=1&clsURI=[/tt]

?

that looks kind of messy. try the urlencode function...

Code:
function newwindow(myTp,myURI)
{
    [red][b]myURI = urlencode( myURI );[/b][/red]
    if (myTp==1) {
        window.open('UIClass.php?shwTp=' + myTp + '&clsURI=' + myURI,'Class Details','width=300,height=200,resizable=yes');
    } else {
        window.open('UIClass.php?shwTp=' + myTp + '&clsURI=' + myURI,'Class Instances','width=300,height=200,resizable=yes');
    }
}



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 

I got it. I used the escape() function and it works!

@cLFlaVA
I need such kind of data because the URL-like data is not a real URL but it is a kind of an ID in my database.

Anyway, thanks to all for the help.
Gabriel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top