如何在不使用jQuery或AJAX的情况下从其他页面获取HTML元素?

时间:2016-08-15 11:04:43

标签: javascript html

我试图在不使用Jquery或AJAX的情况下获取另一页面中System.Drawing.Image PieChart =System.Drawing.Image.FromFile(PieChartPath); oHeader1 = oDoc.Content.Paragraphs.Add(ref oMissing); Logothread = new Thread(() => Clipboard.SetImage(PieChart)); Logothread.SetApartmentState(ApartmentState.STA); //Set the thread to STA Logothread.Start(); Logothread.Join(); oHeader1.Range.Paste(); oHeader1.Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; oHeader1.Range.InsertParagraphAfter(); 的ID。

td

1 个答案:

答案 0 :(得分:0)

试用此代码:

var x = document.getElementsByTagName(" td")[0] .id;

0是该<Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml" xmlns:local="clr-namespace:WpfApplication1" > <!--change the namespace to the one where you ViewModel is--> <Application.Resources> <local:MainWindowViewModel x:Key="ViewModel_MainWindow" /> <!--important--> </Application.Resources> 元素的索引值。您将从变量td获得Id值。