/    Sign up×
Community /Pin to ProfileBookmark

Javascript problem get value

Hi!

i’ve to work on another programmer script and i’m not very good in javascript so i need help.

I want to put an image link into a textfield. When i push a button, a popup window that contain all the image from a specific image folder open and when i click on one of these image it run that script:

function insertImgCalendar()
{
url = “wcmImageNew.asp”;
r = windowOpenSize(url, l,”,’s’,420,575,50,50)
if (r)
{
// Create a IMG Tag to enbed the table
var img=document.createElement(‘img’);

var newAttr = document.createAttribute(“src”)
newAttr.nodeValue=r
img.setAttributeNode(newAttr);

var newAttr = document.createAttribute(“border”)
newAttr.nodeValue=”0″
img.setAttributeNode(newAttr);

var sel = document.selection;

if (sel!=null)
{
var selRange = sel.createRange().text;
var rng = sel.createRange();
if (rng!=null)
{
rng.pasteHTML(img.innerHTML);
}
}
}// end if retrun from TableWizard

[U]document.frmUser.Img_Sponsor.value = …;[/U]
}
the underline part is what i’m trying to do… i guest that rng value will be the value i need but when i write = rng i’ve got OBJECT in my textfield?

Please help!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@turbauthorJun 22.2004 — i think i'm close... if i do this:

document.frmUser.Img_Sponsor.value = rng.pasteHTML(img.innerHTML);

i've got UNDEFINED in my text field Img_Sponsor...
Copy linkTweet thisAlerts:
@ExuroJun 23.2004 — [i]Originally posted by turb [/i]
[size=2]
function insertImgCalendar()
{
url = "wcmImageNew.asp";
r = windowOpenSize(url, l,'','s',420,575,50,50)
if (r)
{
// Create a IMG Tag to enbed the table
var img=document.createElement('img');

[color=red] var newAttr = document.createAttribute("src")
newAttr.nodeValue=r
img.setAttributeNode(newAttr);[/color]
[/size]
[/QUOTE]


Why are you setting the SRC of the image to the new Window object???
×

Success!

Help @turb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...