Problem With Double Quotes In Javascript Link
Feb 10, 2003
I have the following PHP which passes a variable to two other frames:
PHP Code:
$name=addslahes($row['name']);
echo('<tr><td><a href="javascript:
void(parent.frameB.location=/'frameB.php?name='.$name.'&desc='.$desc.'/');
void(parent.frameC.location=/'frameC.php?name='.$name.'&number='.$number.'/');"> '.$row['name'].'</a></td></tr>');
(Note that I have put / in above where there is really a just so that it shows up in the post). The link works fine with normal characters in the variable $name, and it works with single quotes in the varable, but not double quotes (the addslashes() escapes single and double quotes with a backslash).
Why doesn't the link work with double quotes in the variable?
View 12 Replies
ADVERTISEMENT
Jul 20, 2005
how does document.write interpret "" and '' (double quotes and single quotes).what is the significance of &Url (does it signify the current url) colon : is it represented as %3A ? and backslash represented as %2F ?
View 1 Replies
View Related
Mar 1, 2011
I've got this bit of code that I've wrote and it was working absolutely fine like this:
function validatepostcode() {
var postcodevalue = document.getElementById("postcode").value;
if (postcodevalue.indexOf("S") == -1)
{
alert(postcodevalue + " is not a valid postcode.");
[Code]...
What I want to do is wrap the value of "postcodevalue" in double quotes, and since it's inside an alert, I used the escape sequence ", which is how it should be done as far as I know. But for some reason, Dreamweaver's giving me a syntax error warning and the code doesn't work. Am I using the double quotes wrong?
View 23 Replies
View Related
Nov 11, 2010
I have completed the necessary function and it does not need any changes however from the "alert" I need there has to be double quotes surrounding the search 'Lboro'. (I know I may be making a meal of the coding however the lecturer wants us to follow this due to everyone being at different levels of programming). I have used the '' character however the double quotes do not end up in the position I require them?!
My Coding
function findAnyU (s){
var a = s , b , c , d , e = -1;
for (var i = 0 ; i < pages.length && e == -1 ; i++){
b = pages[i].indexOf('[');
c = pages[i].indexOf(']');
d = pages[i].substring(b+1, c).toLowerCase();
e = d.indexOf(s.toLowerCase());
}
if(e >= 1)
a += ' found'
else
a += ' not found'
return (a)
}
alert (findAnyU('Lboro' , pages));
Current Alert =
Lboro found
View 8 Replies
View Related
Nov 30, 2006
im trying to convert a string into arrays in javascript using split() function.
how to i split a string using spaces as a dilimeter but ignoring spaces enclosed by double quotes. ie: john robert "peter rabbit"
View 3 Replies
View Related
Jul 2, 2010
I know that using <a href="javascript:"> and <sometag onclick=""> is evil, but in this particular situation it is quite hard to avoid it due to external powers Anyway here is the issue itself : putting javascript strings inside HTML attributes :
Code:
<button onclick="DoSomething('string')">
Everything is fine until there are single or double quotes INSIDE the 'string' value. Having a double quote inside the string, even JS escaped leads to the onclick argument value being cut :
Code:
<button onclick="DoSomething('str"ing')">
If you replace the double quote by '"' then you don't get a double quote inside DoSomething (you could always replace " by " in JS).
Similar problem if you choose to enclose the onclick argument in single quotes and happen to have a single quote JS escaped inside the string.So, is there any other way of dealing with potential presence of single AND double quotes in the 'string' value, other than replacing them before by ' and " and then replacing them back inside DoSomething ?
View 9 Replies
View Related
Nov 7, 2006
I have the following form, that allows the user to add text to a form field When they click on an image, this works fine, but I need to slightly change the text that is added to the form. Code:
View 1 Replies
View Related
Oct 8, 2011
<html>
<body>
<div id="link">[code].........
I got stuck in getting this to work (show random element of the array as a link with description)
rl.innerHTML='<a href="addr[ri]">addr[ri]</a>';
This is showing addr[ri] on a page and directs to[url]....
View 3 Replies
View Related
Sep 28, 2007
I am having problem to display variable that contains single quotes in its value(res= "msg='error'")value in javascript.I am geting only "msg= " in display.But if i open the jsp code there i got "msg='error' " Any one who know what is the problem please let me know.
document.write("<td align='center'>");
document.write("<th align='center'><b><%=Name%></b></th>");
document.write("</td> ");
document.write("<td >");
document.write("<input type='text' name='param<%=i%>' value='"<%=res[j]%>"' size=ཚ'></input>");
document.write("<br>");
document.write("</td> ");
document.write("</TABLE>");
View 2 Replies
View Related
May 31, 2011
Hello I need help with double clicked. I have a link
The enroll function process data:
And now I have a problem... when I press the button I want it to be disabled to prevent from double clicking... but I've tried removeattr("onclick"), did nothing ...
View 2 Replies
View Related
Jul 23, 2005
I have a problem of escaping quotes in javascript.
Ex:
onclick='alert( "Mister O'Hara" )'
onclick='alert( "Mister O'Hara" )'
both gives me an error. How would I escape this?
View 7 Replies
View Related
Sep 3, 2009
I have a page that submits to a db then re-loads its self with new information. Unfortunately it goes wrong when the user double clicks on a one of many text links that provides the info for the display on reload. How do I stop users from double clicking on the page? Ideally I think I would like to call some sort of js function from body onload as I presume this would then cover the whole of the page, but have no idea if this is possible or how to go about writing it.
View 8 Replies
View Related
Oct 18, 2006
here am tryin to remove the special characters from result
result = '<bean:write name="data" />'
result = result .replace(/[^a-zA-Z 0-9+,-.]+/g,'');
but the problem is
am assigning the value to result using some different launguage so it the result of above is like this:
result = 'Parallel (10') Cable'
result = result .replace(/[^a-zA-Z 0-9+,-.]+/g,'');
noe the error comes as we can see in 1st line ' is comng in the middle of string and string will get terminated .
View 2 Replies
View Related
Jul 14, 2006
I am creating a training manual but i find using pictures slightly
boring. I have created Shockwave/flash files showing in detail how to
use certain things.
I have tried to embbed the shockwave file into powerpoint and it kind
of works.
What i want is to create a link which opens the shockwave file in a new
window, but just the shockwave file without any toolbars or anything.
I noticed javascript files open in a new window which is ideal for me.
How do i do that? I have a powerpoint file and a shockwave file??
View 1 Replies
View Related
Dec 7, 2004
How can I "click" an existing link with javascript so that the referrer is being passed on? please dont answer with "location.href=..." cause that hides the referrer.
View 5 Replies
View Related
Dec 14, 2007
I'm having some problem trying to escape single quotes. basically, I got some text on the database. if text contains double or single quotes, these are replaced with " and ' respectively. I'm using PHP to alert a portion of the text, let's say "hello, y'all!", this way:
PHP Code:
<?php
echo '<script type="text/javascript">'
echo "alert('hello, y'all!');";
echo '</script>'
?>
well, the js code breaks, just as if ''' were converted to the 'single quote' character. how so?
View 4 Replies
View Related
Mar 3, 2010
document.write("<img src=' "+r_image[rand_int]+" '>");
could it not be just written like this:
document.write("<img src='r_image[rand_int]' />");
View 2 Replies
View Related
Jul 23, 2005
I'm writing a FireFox extension and I have the dom and therefor the
links[] collection
window.getBrowser().contentDocument.links[i]
Is there a way to change the color of these links based on the stuff I'm
checking for from the JavaScript?
For example. If I have this loop
var number_of_links = window.getBrowser().contentDocument.links.length;
for (var i=0; i < number_of_links; i++)
{
var domain = window.getBrowser().contentDocument.links[i].hostname;
//Check hostname here and change color
}
how could I change the links color?
View 1 Replies
View Related
Jul 23, 2005
I have a form that I would like to get the values entered on the page
and go to a new page in the same window. I can make the code work to
open a new window, but I need it to open in the same window. Here is what I have:
function pass_info() {
var info = "";
info += document.form2.productWeight.value;
window.open("/page/shippingrates/calculate_shipping_before.asp"
+ "?" + "weight=" + info,");
}
I know that it is the window.open, but I have not figured out what I
need to do to get it in the same window.
View 5 Replies
View Related
Jun 24, 2007
I have a script that is working well to detect if the client has acrobat reader is installed or not. I can print out next to the PDF link if the user has or hasn't got the reader. My problem is that i want to call that function and print something out only if the user clicks on the link to see the PDF file. This is where i'm at at the mo
echo "<br>Price: Euro ";
echo $price."<br />";
echo "<a href = "pdf/$pdf">";
?>
<script type="text/javascript" src="plugins.js">
</script>
<?php
echo "See Pdf</a></td>
";
?>
</tr>
View 1 Replies
View Related
Apr 30, 2002
How do I create an email link using javascript attached to an image link?
The simpler methods I have so far been able to find only work within form elements.
I have also tried...
window.location="mailto:contact@mydomain.com"
parent.location="mailto:contact@mydomain.com"
location.href="mailto:contact@mydomain.com"
... none of which seem to work.
What's the secret? Where am I going wrong?
View 4 Replies
View Related
Aug 20, 2009
How can I add single quotes around listObj.options[i].value. I still want to keep the comma I'm adding to the end of it. code...
View 1 Replies
View Related
Nov 26, 2009
I am trying to find a script that basically does the following:
-I have a list of quotes
-A script that chooses one by random
-The quote fades in (through opacity). Is displayed for 10 seconds then fades out.
-Repeats by selecting a new random quote.
View 1 Replies
View Related
Aug 20, 2009
How can I add single quotes around listObj.options[i].value. I still want to keep the comma I'm adding to the end of it. code...
View 1 Replies
View Related
Aug 17, 2010
This little snippet of code produces random quotes but sometimes gives a missing quote between two quote marks.
<HTML>
<HEAD>
<TITLE>Javascript - RANDOM QUOTES</TITLE>
<script type="text/javascript">
[code].....
I use around 50 quotes in the real thing.
View 4 Replies
View Related
Apr 15, 2011
I am just learning the basics and am trying to figure out timing with setTimeout()
<script type="text/javascript">
document.write("<p>" + Date() + "</p>");
setTimeout("document.write('Hello There World');", 2000);
setTimeout("document.write("<p>" + Date() + "</p>");", 2000);
</script>
the 1st document.write works and the 1st setTimeout() works, but then I add the fourth line and the page will not load.
Why does it not like my 4th line : "setTimeout("document.write("<p>" + Date() + "</p>");", 2000);"?
View 6 Replies
View Related