0
<html>
<head>
<script type="text/javascript">

function getpr(txt2){
alert("I'm in");
document.write(txt2);
}


function message()
{
var doc = new ActiveXObject("Word.Application"); // creates the word object
doc.Visible=false; // doesn't display Word window
doc.Documents.Open("C:\\Users\\vinay\\Desktop\\HTMLPages\\test\\pr.txt"); // specify path to 
document
//copy the content from my word document and throw it into my variable
txt = doc.Documents("C:\\Users\\vinay\\Desktop\\HTMLPages\\test\\pr.txt").Content; 
prnumber=txt;
//alert("PR number is Set to :" + prnumber + "!");
document.write(prnumber);
doc.quit(0); // quit word (very important or you'll quickly chew up memory!)

getpr(prnumber);
}

</script>
</head>

<body onload="message()">
</body>
</html>

========================
Above script getpr() function is not working it is printing
"Undefined"
but document.write(prnumber); is printing

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by JugglerDrummer
0

Your function prints the variable passed to it, and you pass it the value of doc.Documents("C:\\Users\\vinay\\Desktop\\HTMLPages\\test\\pr.txt").Content; I would imagine that's returning a null or undef value. Also, be careful with document.write in the head, best to use innerHTML to set content of existing elements. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.