Cannot Pass Parameters Containing Hyphen / Dot

Jun 13, 2009

I am trying to pass dynamic String parameter to my javascript. The user enters sdome value and that is passed to the javascript as parameter. My problem is when user enters something of type cs204-1 or cs204.1 etc, the javascript does not run. On passing simple parameters like cs204 or 111 etc, the javascript works fine. I need to pass any type of parameters to the javascript ( cs204-1 or cs204.1 etc) as I am making this for my college and the values to be entered by the user are of such type.

My javascript code is :
function deleteQuestion(id){
alert(id);
questionId= eval("document.form1.deleteQ"+id+".value");
url='/DeleteQuestionServlet?questionId='+escape(questionId);
document.form1.action=url;
}
I tested the working of the javascript by using alert. It came for normal parameters but not for cs204-1 or cs204.1 types.

View 1 Replies


ADVERTISEMENT

Cannot Pass Parameters Containing Hyphen(-) - Dot(.)

Jun 13, 2009

I am trying to pass dynamic String parameter to my javascript. The user enters sdome value and that is passed to the javascript as parameter. My problem is when user enters something of type cs204-1 or cs204.1 etc, the javascript does not run. On passsing simple parameters like cs204 or 111 etc, the javascript works fine. I need to pass any type of parameters to the javascript ( cs204-1 or cs204.1 etc) as I am making this for my college and the values to be entered by the user are of such type. My javascript code is : Code:

[Code]...

I tested the working of the javascript by using alert. It came for normal parameters but not for cs204-1 or cs204.1 types.

View 3 Replies View Related

Pass Parameters In The <script ..> Tag?

Sep 4, 2010

how to pass parameters in the <script ..> tag? for instance;

<script type="text/javascript" src="script.js?param1=val1¶m2=val2&etc">

in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js

View 7 Replies View Related

How To Pass Parameters In URL For Javascript Refresh?

Jul 23, 2005

I have an easy question, likely, that has me in a headspin. I have an
include file to a frames based site that basically forces frames on
the end user if they visit the site and hit a non-frames created
page...

Simply, it is:

if (parent != self)
self.parent.location.replace("/");

However, now I would like to force an inner frame to populate based on
what frame someone was redirected from the include (above). So, if I
visit http://domain/frame/innerframe_3.html, then I want to redirect
to the above, but pass in /frame/innerframe_3.html to be included as a
URL parameter for an inner frame to be populated.

When I modify this link to:

if (parent != self)
self.parent.location.replace("/index.php?redir=" & location.href);

Then, the replaced location doesn't seem to recognize the ?redir=
portion of the new location.

Is there a different way to do this? I can't use a META tag because I
want the TARGET to be _TOP, basically.

View 3 Replies View Related

JQuery :: Pass Parameters To Selectors/has?

Oct 5, 2009

My button when click call cal function, inside cal function I need to find parent so I can access other element, but I donot know how to pass parameter to Selectors/has(for some reason $("div :button").each(function()... no work here)

Code as below:
function cal(event) {
if (!event) event = window.event;

[code]....

View 1 Replies View Related

Pass And Get Multiple Parameters In Another Page?

Sep 15, 2009

Hi all.Am new to this forum so cut me some slack if I don't articulate my problem with utmost clarity.My problem is that I have a javascript function such as:

function modReg(x,y)
{
<!--
var answer = confirm ("Do you really want to deregister user" +x+"?")
if (answer)
{
document.leo["id"].value=x;

[Code]...

Now, leo is a hidden form with the 2 fields namely "id and "two".Viewing source, I see that the parameters I need are well acquired by the function.In next page, I haven't been successful at retrieving the passed parameters.

View 9 Replies View Related

Can't Pass 2 Parameters On An Onclick In Href

Apr 12, 2010

I am having some issues with getting a variable from an onclick event with javascript.

$('#preview_logo').append('<img src="'+fileObj.filePath+'" height="100px" hspace="5" /> '+fileObj.name+' uploaded.<a href="javascript:;" id="dele_image" onclick="del_image('+fileObj.filePath+','+fileObj.name+');">Upload Different Image</a><br>');

This is for uploadify script for previewing an image that is uploaded, it creates the link fine, but won't trigger the function "del_image" unless I delete the parameters in the onclick, which leads me to believe it is something to do with my quoting. Here is the function:

[Code]....

View 7 Replies View Related

JQuery :: Pass Parameters Into The Plugin?

Dec 14, 2011

I have been checking out the following sitepoint tutorial on creating a plugin using Jquery http:[url]....I have some Questions about the selector and the parameters.Say for example, I wanted to pass parameters into the plugin:

Code:
(function($) {
// jQuery plugin definition[code].....

And conversely if the plugin takes no parameters $(selector).MyPlugin(); Firstly is my understanding correct and secondly what if the plugin doesn't require a selector? What if it doesn't need to do anything to a given DOM element? would it be something like:

$().MyPlugin(someparameters)

View 2 Replies View Related

Way To Pass Parameters Via URL To A HTML Form

Feb 22, 2010

I am passing parameters via URL to my HTML form. The hardcoded hidden values work. Does anyone know how I can modify this so that the parameters can also write to the hidden values?code...

View 3 Replies View Related

Pass Parameters On B.onclick = Test Function?

May 30, 2010

I want to pass two parameters on button "b" click. how to pass parameters on b.onclick = test function?

function test(x, y){
alert(y);
}
var b = document.getElementById('b');

b.onclick = test; //how to pass x and y parameter?

View 5 Replies View Related

Can't Get Object Constructor To Pass Other Objects As Parameters

Jun 12, 2011

I have a code set up something like this:

[Code]....

The problem is I keep getting an error along the lines of: TypeError: Result of expression 'house' [[object Object]] is not a constructor. It seemed to work when I wasn't passing the other objects as parameters in the constructor. I just created and assigned them later. As in:

[Code]...

View 4 Replies View Related

Jquery :: Function Parameters - Pass Var HoverText To The Hover Out

Jun 9, 2010

I am trying to remove a title attribute for a link on hover and then add it back on mouse out. I would like to pass var hoverText to the hover out...

[Code]...

View 3 Replies View Related

Open A Popup Window From A PHP Site And Pass In Some Parameters To Use In The Pop Up Window

Sep 23, 2010

I need to open a popup window from a PHP site and pass in some parameters to use in the pop up window. I have the params in an input box and need to get the val of the box into a param and pass it to the new popup window. All pages are local and in the same folder. The id of the input box is 'ddutykey'. The name of the new window would be showduty.php if possible.

View 3 Replies View Related

JS Var With Hyphen = NaN

Mar 27, 2003

I am sending credit card information to a merchant account script. The documentation for the MA states the variable names it requires, things like card-type, card-number, card-exp. So I have input fields for each.

The problem is my JS validation function will not recognize these variables if they have a hyphen. If I change the hyphen to underscore, the function will recognize them, ex:
<input type="text" name="card-number">
<input type="text" name="card_number">

alert(document.frm.card-number.value);//NaN
alert(document.frm.card_number.value);//works

I can not change the field names to use underscores because the payment script is looking for the hyphen variable name. Anyone know how I can get the values of these fields with hyphens?

View 3 Replies View Related

Pre Defined Hyphen As Variable Name?

Jun 17, 2010

I am currently working with a cms system that doesnt keep within the correct name conventions (pre defined).Within a form, I simply want to set a date to todays date:

<script type="text/javascript">
function initdt(mf) {
var t = new Date;

[code]...

This works perfect on a form I create, but sadly I must use a form within a pre defined system that uses "01-date" Is there a way around this? A simple way of setting 01-date to t.getDate();

View 2 Replies View Related

Match All Integers Before And After The Hyphen?

Feb 24, 2010

I'm trying to match all integers before and after the hyphen:

12345-5

This is what I tried but always returns null

Code:

var divID = '12345-5';
var idPattern = /^[0-9]+$/; //Matching one or more numbers before the hyphen
var id2Pattern = /^-[0-9]+$/; //Matching starts from the hyphen and all numbers that proceed

[code]....

View 4 Replies View Related

Username Verification - Accept Only A-z0-9 And _(underscore),-(hyphen) And .(dot)

Jul 19, 2011

I have written a function for accepting name and should be atleast minimum 4 characters. It is accepting all characters including special characters. Now i want my function to accept only a-z0-9 and _(underscore),-(hyphen) and .(dot) Below is my function

[Code]...

View 24 Replies View Related

How To Include Dot / Hyphen In Name Section Of Email Address

Jul 21, 2010

This is the regular expression I currently have
/^(w+|w+.w+)@(w+|w+-w+).(w{2,3}|w{2,3}.w{2,3})$/;
The script dates from about 2006. The script is ok for emails that just contain a "dot" before the @, as in: joe.bloggs@home.com

What needs to be changed in the above script to allow both these types of email?
joe.bloggs@home.com and
joe.bloggs-smith@home.com

View 2 Replies View Related

Zip Code Validation / Formatting - Adding Hyphen Automatically

Feb 7, 2011

I need US zip code formatting on my page. As zip code can be 5 digits or 5-4 digits, our requirement is that when user types in 6th digit, hyphen automatically gets added between 5th and 6th digit. Ex: user enters 100161, it should become formatted as 10016-1 and then user can continue to add rest of digits.

View 1 Replies View Related

In What Situations Would You 'Pass By Value' And 'Pass By Reference'

Nov 20, 2007

I have been trying to grasp the whole 'Pass By Value/Reference' thing for a few hours now. From what i can make out:

Passing by value will make a copy of the value, pass it as a function argument and the function will store the changes, the original value is not affected. So for example:

JavaScript Code:
var cost = 145;var postage = .3;var a = function() {return cost + postage;} //Using an Anonymous function for this

If you was then to pass the value of 'a' to a function argument it would copy and not change the original value.

If you pass by reference it will change the original value. When you pass a reference to a value through a series of different functions and the value is constantly being changed the change happens on the original value and can be seen outside the function.

The problem is i cannot think of how or why this would be used. I havn't got to develop many large applications so im trying to think of a few situations when passing by reference would be used.

View 5 Replies View Related

Function/parameters

Jul 23, 2005

I have a problem with the following function:

I would like to define the hight/length of the window which I open when
I call the function.

The problem is that the window opens but not with the size I defined
when calling the function. Code:

View 5 Replies View Related

Reading Parameters Using Js, From A Url

Jul 23, 2005

Can someone give me some pointers on how I can read one or more
arguements from a url, using js?

Why? I'm working on a LAMP based project and when a user successfully
registers, the header redirects to the login screen - I'd like to check
for the value of register, if read from:

http://www.mydomain.com/index.html?register=success

A pointer/hint as opposed to a solution should be sufficient because I'm
doing pretty well learning javascript.

View 1 Replies View Related

Getting Parameters From The Get Method

Oct 6, 2005

I am pretty rusty with javascript and I am trying to make a webpage
that will basically act as a wrapper from one webpage to another. What
I mean by this is that I will hit this page like:
webpage.htm?Param1=... and I will take the passed params and post them
to another page. I have the post part working, but I was just
wondering how I can use just Javascript and read those values passed to
this webpage. Is this even possible?

View 3 Replies View Related

Extracting Parameters

Jun 2, 2007

I found this little script for extracting parameters from a url but wondered
what the shortest and most efficient way to do it would be, like the
following or via regexp?

function getParameter(paramName) {
var currentUrl = window.location.search
var strBegin = currentUrl.indexOf(paramName) + (paramName.length+1)
var strEnd = currentUrl.indexOf("&",strBegin)

if (strEnd==-1)
strEnd = currentUrl.length
return currentUrl.substring(strBegin,strEnd)
}

Any shorter way?

View 1 Replies View Related

Onclick Parameters

Jul 20, 2005

I have an onclick function that pops a new window (nothing fancy) the problem is that whenever I want to return to the page where I popped the new window from I find that it is reloaded and has taken me to the fist line of the page. What parameter (or anything else for that matter) can I add in order to pop up a new window and still be in the same place when I return to the previous page?

View 2 Replies View Related

JQuery :: Get And Set URL Parameters?

Apr 21, 2011

I need to know a way to get/set URL parameters with jQuery.

Here is the flow between pages im having:

What i want to have is:

Each page offers a choice to user and must add the choice in url. Actually im using forms with submit buttons to do it but i dont know how to keep parameters from previous page in the current page.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved