Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do I pass the variable "appName" from the SerialPopUp function to the pop up window I create? Thank you in advance for any help you can give me.
function SerialPopUp(appInfo)
{
appInfo=appInfo.split("\n");
var appName = appInfo[1].trim();
var appType = appInfo[5].trim();
var url = appInfo[7].trim();
url = appInfo[7].substring(9,appInfo[7].indexOf(">")-17);
var serialNum = "";
if(appType == 'External Paid'){
x = window.open(url, "Get Serial Number","resizable=1,status=1, width=700, height=250");
x.document.getElementById("appName").innerHTML= appName;
}
}
try
if(appType == 'External Paid'){
url = url + '?appName=' + appName;
x = window.open(url, "Get Serial Number","resizable=1,status=1, width=700, height=250");
x.document.getElementById("appName").innerHTML= appName;
}
This will pass the variable to the pop up window in the url.
Use a query string variable. Extra text here.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a link:
http://blog.isvn.pl/search/music
How can I modify this link with jQuery to get:
http://blog.isvn.pl/tagged/music
I want change only „search“ to „tagged“, and open new link.
You can use replace()
var url = 'http://blog.isvn.pl/search/music';
var newUrl = url.replace('/search/', '/tagged/');
window.location.href = newUrl;
//or, to open in a new window:
window.open(url,'_blank');
Demo
You can use
var value = 'http://blog.isvn.pl/search/music';
value = value.replace("search", "tagged");
alert(value);
use the replace function in javascript:
var currentUrl = "http://blog.isvn.pl/search/music";
var replacedUrl = currentUrl.replace("/search/", "/tagged/");
I use /search/ (with the slashes) so it only replaces when it is a folder in the path. Otherwise it would also replace when the word search in in a song title.
You can use replace(), to replace search with tagged
Live Demo
url = url.replace('search', 'tagged');
To change the url
window.location.href = window.location.href.replace('search', 'tagged');
OR
window.location.href = document.URL.replace('search', 'tagged');
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to see if variable is < or equal to 0
Heres my code im working with.
theres other behind the scenes stuff to do with lives but all i need to know
is how to see its value (more below)
function beginCountup() {
var display = document.getElementById("display"),
i = 0;
intervalID = setInterval(function () {
display.textContent = ++i;
}, 26);
lives = lives - 1;
var lcount = document.getElementById('lives')
lcount.innerHTML = lives;
}
So i need to see if lives < or equal to 0 if so i need it to target ElementById('lives')
and make it say game over thanks!
Simple if statement
if(lives<=0){
document.getElementById("lives").innerHTML="Game Over!"
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How would I write an if statement that alerts when the var MyString is not in the var URL?
var URL = "http://test.mysite.com/about/";
var MyString = "mysite.com";
if (URL.indexOf(MyString) === -1) {
alert('Not found!');
}
if(URL.indexOf(MyString) == -1) alert("Not found");
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
This is a simple question about JavaScript,
Say I got the following string:
A)My Name B)My Name C)My Name
now I give to a function the key #1 expecting to replace the second occurrence of My Name inside that function and return:
A)My Name B) C)My Name
I haven't found the solution to this anywhere online so I'm asking.
You could use split to separate the string into the parts, then join the before and after back together:
function removeNthMatch(input, removeString, removeIndex) {
var splitString = input.split(removeString);
result = splitString.slice(0, removeIndex + 1).join(removeString)
+ splitString.slice(removeIndex + 1).join(removeString);
}
input = "A)My Name B)My Name C)My Name";
removeString = "My Name";
removeIndex = 1;
console.log(removeNthMatch(input, removeString, removeIndex));
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to get the id of an radiobutton to be added to href when the link is clicked. I tried searching google for a long time. But maybe i'm missing because it's very basic.
I do have a bit of code written but it doesn't work. Help?
function ProductIDLink() {
var url = "/bbbb/aaaaaaa/" + ('.aaasaff:radio:checked').attr('id');
$("#safad").attr("href", url)
}
Looks like you've just forgotten a $:
... ('.aaasaff:radio:checked').attr('id')
should be
... $('.aaasaff:radio:checked').attr('id')
From what I can see the $ was missing.
function ProductIDLink() {
var url = "/bbbb/aaaaaaa/" + $('.aaasaff:radio:checked').attr('id');
$("#safad").attr("href", url)
}